#include "svghelper.h"

#include <QPainter>
#include <QtSvg/QSvgRenderer>

#include <QtXml/QDomDocument>


SvgHelper::SvgHelper(QObject *parent) : QObject{parent} {}




QPixmap SvgHelper::getPixmap(const QString &svgName, const QColor &color,
                             quint32 size, quint32 width, quint32 height) {
    // 主动绘制图形字体到图片
    QPixmap pix(width, height);
    pix.fill(Qt::transparent); // 用透明色填充

    QPainter painter(&pix);
    // painter.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing);
    // painter.setPen(color);

    QSvgRenderer render(svgName);
    render.render(&painter);

    return pix;
}


